package com.gas.project.gas.teacher.domain;

import java.util.Arrays;
import java.util.Date;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.gas.framework.aspectj.lang.annotation.Excel;
import com.gas.framework.web.domain.BaseEntity;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

/**
 * 教职工信息对象 gas_teacher
 *
 * @author xyl
 * @date 2022-04-02
 */
public class Teacher extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /**
     * 教师工号
     */
    @Excel(name = "教师工号")
    private String teacherNumber;

    /**
     * 姓名
     */
    @Excel(name = "姓名")
    private String teacherName;

    /**
     * 职位
     */
    @Excel(name = "职位")
    private String position;

    /**
     * 性别
     */
    @Excel(name = "性别")
    private String gender;

    /**
     * 入职时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "入职时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date entryTime;

    public void setTeacherNumber(String teacherNumber) {
        this.teacherNumber = teacherNumber;
    }

    public String getTeacherNumber() {
        return teacherNumber;
    }

    public void setTeacherName(String teacherName) {
        this.teacherName = teacherName;
    }

    public String getTeacherName() {
        return teacherName;
    }

    public void setPosition(String position) {
        this.position = position;
    }

    public String getPosition() {
        return position;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public String getGender() {
        return gender;
    }

    public void setEntryTime(Date entryTime) {
        this.entryTime = entryTime;
    }

    public Date getEntryTime() {
        return entryTime;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("teacherNumber", getTeacherNumber())
                .append("teacherName", getTeacherName())
                .append("position", getPosition())
                .append("gender", getGender())
                .append("entryTime", getEntryTime())
                .append("createTime", getCreateTime())
                .append("createBy", getCreateBy())
                .append("updateTime", getUpdateTime())
                .append("updateBy", getUpdateBy())
                .append("remark", getRemark())
                .toString();
    }

    public String check(Teacher teacher) {
        if (StringUtils.isBlank(teacher.getTeacherNumber())) {
            return "教师学号不能为空！";
        }
        if (StringUtils.isBlank(teacher.getTeacherName())) {
            return "教师姓名不能为空！";
        }
        if (StringUtils.isBlank(teacher.getPosition())) {
            return "职位不能为空！";
        }
        if (StringUtils.isBlank(teacher.getGender())) {
            return "性别不能为空！";
        }
        if (teacher.getEntryTime() == null) {
            return "入职时间不能为空！";
        }
        return null;
    }
}
